﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLHocSinh.DTO;
using QLHocSinh.DAO;
using QLHocSinh.BUS;

namespace QLHocSinh.BUS
{
    public enum HocSinhBUSResult
    {
        OK,
        HOTENERROR,
        GIOITINHERROR,
        NGAYSINHERROR,
        DIACHIERROR,
        EMAILERROR,
        MALOPERROR,
        DAOERROR
    }
    public class HocSinhBUS
    {
        public static DataTable LayDanhSachHocSinh()
        {
            return HocSinhDAO.SelectAll();
        }
        public static HocSinhBUSResult ThemLopHoc(HocSinhDTO hs)
        {
            if (!HocSinhDAO.InsertProc(hs))
                return HocSinhBUSResult.DAOERROR;
            return HocSinhBUSResult.OK;
        }
        public static HocSinhBUSResult SuaLopHoc(HocSinhDTO hs)
        {
            if (!HocSinhDAO.UpdateProc(hs))
                return HocSinhBUSResult.DAOERROR;
            return HocSinhBUSResult.OK;
        }

        public static HocSinhBUSResult XoaLopHoc(HocSinhDTO hs)
        {
            if (!HocSinhDAO.DeleteProc(hs))
                return HocSinhBUSResult.DAOERROR;
            return HocSinhBUSResult.OK;
        }
    }
}
